Optimal. Leaf size=86 \[ a^2 A x+\frac {\left (4 a A b+2 a^2 B+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b (2 A b+3 a B) \tan (c+d x)}{2 d}+\frac {b B (a+b \sec (c+d x)) \tan (c+d x)}{2 d} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.06, antiderivative size = 86, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 4, integrand size = 23, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.174, Rules used = {4003, 3855,
3852, 8} \begin {gather*} \frac {\left (2 a^2 B+4 a A b+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+a^2 A x+\frac {b (3 a B+2 A b) \tan (c+d x)}{2 d}+\frac {b B \tan (c+d x) (a+b \sec (c+d x))}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 8
Rule 3852
Rule 3855
Rule 4003
Rubi steps
\begin {align*} \int (a+b \sec (c+d x))^2 (A+B \sec (c+d x)) \, dx &=\frac {b B (a+b \sec (c+d x)) \tan (c+d x)}{2 d}+\frac {1}{2} \int \left (2 a^2 A+\left (4 a A b+2 a^2 B+b^2 B\right ) \sec (c+d x)+b (2 A b+3 a B) \sec ^2(c+d x)\right ) \, dx\\ &=a^2 A x+\frac {b B (a+b \sec (c+d x)) \tan (c+d x)}{2 d}+\frac {1}{2} (b (2 A b+3 a B)) \int \sec ^2(c+d x) \, dx+\frac {1}{2} \left (4 a A b+2 a^2 B+b^2 B\right ) \int \sec (c+d x) \, dx\\ &=a^2 A x+\frac {\left (4 a A b+2 a^2 B+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b B (a+b \sec (c+d x)) \tan (c+d x)}{2 d}-\frac {(b (2 A b+3 a B)) \text {Subst}(\int 1 \, dx,x,-\tan (c+d x))}{2 d}\\ &=a^2 A x+\frac {\left (4 a A b+2 a^2 B+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))}{2 d}+\frac {b (2 A b+3 a B) \tan (c+d x)}{2 d}+\frac {b B (a+b \sec (c+d x)) \tan (c+d x)}{2 d}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.29, size = 67, normalized size = 0.78 \begin {gather*} \frac {2 a^2 A d x+\left (4 a A b+2 a^2 B+b^2 B\right ) \tanh ^{-1}(\sin (c+d x))+b (2 A b+4 a B+b B \sec (c+d x)) \tan (c+d x)}{2 d} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.30, size = 112, normalized size = 1.30
method | result | size |
derivativedivides | \(\frac {a^{2} A \left (d x +c \right )+a^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 A b a \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 B a b \tan \left (d x +c \right )+A \,b^{2} \tan \left (d x +c \right )+b^{2} B \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )}{d}\) | \(112\) |
default | \(\frac {a^{2} A \left (d x +c \right )+a^{2} B \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 A b a \ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )+2 B a b \tan \left (d x +c \right )+A \,b^{2} \tan \left (d x +c \right )+b^{2} B \left (\frac {\sec \left (d x +c \right ) \tan \left (d x +c \right )}{2}+\frac {\ln \left (\sec \left (d x +c \right )+\tan \left (d x +c \right )\right )}{2}\right )}{d}\) | \(112\) |
norman | \(\frac {a^{2} A x +a^{2} A x \left (\tan ^{4}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )+\frac {b \left (2 A b +4 B a +B b \right ) \tan \left (\frac {d x}{2}+\frac {c}{2}\right )}{d}-2 a^{2} A x \left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )-\frac {b \left (2 A b +4 B a -B b \right ) \left (\tan ^{3}\left (\frac {d x}{2}+\frac {c}{2}\right )\right )}{d}}{\left (\tan ^{2}\left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )^{2}}-\frac {\left (4 A b a +2 a^{2} B +b^{2} B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )-1\right )}{2 d}+\frac {\left (4 A b a +2 a^{2} B +b^{2} B \right ) \ln \left (\tan \left (\frac {d x}{2}+\frac {c}{2}\right )+1\right )}{2 d}\) | \(184\) |
risch | \(a^{2} A x -\frac {i b \left (B b \,{\mathrm e}^{3 i \left (d x +c \right )}-2 A b \,{\mathrm e}^{2 i \left (d x +c \right )}-4 B a \,{\mathrm e}^{2 i \left (d x +c \right )}-B b \,{\mathrm e}^{i \left (d x +c \right )}-2 A b -4 B a \right )}{d \left ({\mathrm e}^{2 i \left (d x +c \right )}+1\right )^{2}}-\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) A b a}{d}-\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) B}{d}-\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}-i\right ) b^{2} B}{2 d}+\frac {2 \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) A b a}{d}+\frac {a^{2} \ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) B}{d}+\frac {\ln \left ({\mathrm e}^{i \left (d x +c \right )}+i\right ) b^{2} B}{2 d}\) | \(217\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [A]
time = 0.27, size = 126, normalized size = 1.47 \begin {gather*} \frac {4 \, {\left (d x + c\right )} A a^{2} - B b^{2} {\left (\frac {2 \, \sin \left (d x + c\right )}{\sin \left (d x + c\right )^{2} - 1} - \log \left (\sin \left (d x + c\right ) + 1\right ) + \log \left (\sin \left (d x + c\right ) - 1\right )\right )} + 4 \, B a^{2} \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 8 \, A a b \log \left (\sec \left (d x + c\right ) + \tan \left (d x + c\right )\right ) + 8 \, B a b \tan \left (d x + c\right ) + 4 \, A b^{2} \tan \left (d x + c\right )}{4 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [A]
time = 4.05, size = 136, normalized size = 1.58 \begin {gather*} \frac {4 \, A a^{2} d x \cos \left (d x + c\right )^{2} + {\left (2 \, B a^{2} + 4 \, A a b + B b^{2}\right )} \cos \left (d x + c\right )^{2} \log \left (\sin \left (d x + c\right ) + 1\right ) - {\left (2 \, B a^{2} + 4 \, A a b + B b^{2}\right )} \cos \left (d x + c\right )^{2} \log \left (-\sin \left (d x + c\right ) + 1\right ) + 2 \, {\left (B b^{2} + 2 \, {\left (2 \, B a b + A b^{2}\right )} \cos \left (d x + c\right )\right )} \sin \left (d x + c\right )}{4 \, d \cos \left (d x + c\right )^{2}} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \int \left (A + B \sec {\left (c + d x \right )}\right ) \left (a + b \sec {\left (c + d x \right )}\right )^{2}\, dx \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [B] Leaf count of result is larger than twice the leaf count of optimal. 192 vs.
\(2 (80) = 160\).
time = 0.49, size = 192, normalized size = 2.23 \begin {gather*} \frac {2 \, {\left (d x + c\right )} A a^{2} + {\left (2 \, B a^{2} + 4 \, A a b + B b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) + 1 \right |}\right ) - {\left (2 \, B a^{2} + 4 \, A a b + B b^{2}\right )} \log \left ({\left | \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 1 \right |}\right ) - \frac {2 \, {\left (4 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} + 2 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{3} - 4 \, B a b \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - 2 \, A b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right ) - B b^{2} \tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )\right )}}{{\left (\tan \left (\frac {1}{2} \, d x + \frac {1}{2} \, c\right )^{2} - 1\right )}^{2}}}{2 \, d} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 2.74, size = 176, normalized size = 2.05 \begin {gather*} \frac {2\,\left (A\,a^2\,\mathrm {atan}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+B\,a^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )+\frac {B\,b^2\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )}{2}+2\,A\,a\,b\,\mathrm {atanh}\left (\frac {\sin \left (\frac {c}{2}+\frac {d\,x}{2}\right )}{\cos \left (\frac {c}{2}+\frac {d\,x}{2}\right )}\right )\right )}{d}+\frac {\frac {A\,b^2\,\sin \left (2\,c+2\,d\,x\right )}{2}+\frac {B\,b^2\,\sin \left (c+d\,x\right )}{2}+B\,a\,b\,\sin \left (2\,c+2\,d\,x\right )}{d\,\left (\frac {\cos \left (2\,c+2\,d\,x\right )}{2}+\frac {1}{2}\right )} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________